import time

from library import lcd1602
from library import respberrypi

if __name__ == '__main__':
    DATA_PIN = 4
    respberrypi.gpio_init(in_channels=[DATA_PIN])

    lcd_addr = 0x27
    i2c_port = 1
    my_lcd = lcd1602.LCD(lcd_addr, i2c_port)
    my_lcd.lcd_clear()

    while True:
        value = respberrypi.gpio_input(DATA_PIN)
        if value == 1:
            my_lcd.lcd_display_string("there's water")
        else:
            my_lcd.lcd_display_string("there's no water")
        time.sleep(1)
        my_lcd.lcd_clear()
